<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>apply/call</title>
</head>

<body>
    <div id="app">
        <ul>
            <li>1</li>

            <li>2</li>

            <li>3</li>

            <li>4</li>
        </ul>

    </div>
</body>
<script>
    // Array.prototype.forEach.call([1, 2, 3], function (item) {
    //     console.log(item)
    // })
    let list = document.getElementsByTagName("li")
    //方法1
    Array.prototype.forEach.call(list, function (item) {
        console.log(item)
    })
    //方法2
    // HTMLCollection.prototype.forEach = Array.prototype.forEach
    // list.forEach(function (item) {
    //     console.log(item)
    // })
</script>

</html>